<?php
namespace org\phpstruct\db\ORM;

use org\phpstruct\core;
use org\phpstruct\db;
use org\phpstruct\db\I;
use org\phpstruct\db\PDO;

/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of WhereClauseDTO
 *
 * @author emanuele.colonnelli
 */
class WhereClause {

  private $fields = array();
  private $values = array();
  private $condition = ' AND ';
  private $clause = 'WHERE ';

  function __construct(WhereCondition $condition) {
    $this->clause.= "$condition";
  }//

  /**
   *
   * @param WhereCondition $condition
   * @return dto_WhereClause
   */
  public function _and(WhereCondition $condition) {
    $this->clause .= " AND {$condition}";
    return $this;
  }

  /**
   *
   * @param WhereCondition $condition
   * @return dto_WhereClause
   */
  public function _or(WhereConditionDTO $condition) {
      $this->clause .= " OR {$condition}";
      return $this;
  }

  public function  __toString() {
    return $this->clause;
  }

  public function getFields() {
    return $this->fields;
  }

  public function setFields($fields) {
    $this->fields = $fields;
  }

  public function getValues() {
    return $this->values;
  }

  public function setValues($values) {
    $this->values = $values;
  }
    
}
